﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pyramid.Extentions;

namespace Pyramid.Models
{
	/// <summary>
	/// 顾客健康档案基础信息
	/// </summary>
	public class CustomerHealthArchiveMaster
	{
		public int Id { get; set; }

		public int CustomerId { get; set; }

		[Display(Name = "顾客编码")]
		[MaxLength(20)]
		public string CustomerCode { get; set; }

		[Display(Name = "顾客姓名")]
		[MaxLength(20)]
		public string CustomerFullName { get; set; }

		[Display(Name = "建档日期")]
		public DateTime CreateTime { get; set; }

		[Display(Name = "建档人")]
		[MaxLength(20)]
		public string CreateUserId { get; set; }

		[Display(Name = "最后修改时间")]
		public DateTime EditTime { get; set; }

		[Display(Name = "最后修改人")]
		[MaxLength(20)]
		public string EditUserId { get; set; }

		[ForeignKey("CustomerId")]
		public virtual Customer Customer { get; set; }

		public virtual ICollection<ExpertDiagnosisRecord> ExpertDiagnosisRecords { get; set; }
		public virtual ICollection<TreatmentPlan> TreatmentPlans { get; set; }
		public virtual ICollection<CustomerHealthManageRecord> CustomerHealthManageRecords { get; set; }
		public virtual ICollection<ReturnVisitRecord> ReturnVisitRecords { get; set; }

		#region health base info

		[Display(Name = "身高(cm)")]
		public double Height { get; set; }

		[Display(Name = "体重(kg)")]
		public double Weight { get; set; }

		[Display(Name = "体型")]
		public int BodilyForm { get; set; }

		[NotMapped]
		public BodilyForms BodilyFormEnum
		{
			get { return (BodilyForms) BodilyForm; }
		}

		[NotMapped]
		public string BodilyFormString
		{
			get { return BodilyFormEnum.ToDescription(); }
		}

		[Display(Name = "过敏史")]
		[MaxLength(500)]
		public string Hypersusceptibility { get; set; }

		[Display(Name = "疾病史")]
		[MaxLength(500)]
		public string Disease { get; set; }

		[Display(Name = "手术史")]
		[MaxLength(500)]
		public string Operation { get; set; }

		[Display(Name = "遗传病史")]
		[MaxLength(500)]
		public string Heredopathia { get; set; }

		/// <summary>
		/// 人体八大系统健康状况
		/// 格式：各选项ID集和序列化字符串
		/// </summary>
		[Display(Name = "人体八大系统健康状况")]
		[MaxLength(500)]
		public string HumanBodySystem { get; set; }

		#endregion
	}

	/// <summary>
	/// 专家诊断记录
	/// </summary>
	public class ExpertDiagnosisRecord
	{
		public int Id { get; set; }
		public int MasterId { get; set; }

		[Display(Name = "部位")]
		[MaxLength(20)]
		public string Region { get; set; }

		[Display(Name = "照片")]
		[MaxLength(500)]
		public string Pictures { get; set; }

		[Display(Name = "成因")]
		[MaxLength(500)]
		public string Reason { get; set; }

		[Display(Name = "专家意见")]
		[MaxLength(500)]
		public string Suggestion { get; set; }

		[ForeignKey("MasterId")]
		public virtual CustomerHealthArchiveMaster Master { get; set; }
	}

	/// <summary>
	/// 疗程设计
	/// </summary>
	public class TreatmentPlan
	{
		public int Id { get; set; }
		public int MasterId { get; set; }

		[Display(Name = "实施日期")]
		public DateTime MaterialDate { get; set; }

		[Display(Name = "部位")]
		[MaxLength(20)]
		public string Region { get; set; }

		[Display(Name = "产品配备")]
		[MaxLength(500)]
		public string ArrangedProducts { get; set; }

		[Display(Name = "预期效果")]
		[MaxLength(500)]
		public string ExpectedEffect { get; set; }

		[Display(Name = "注意事项")]
		[MaxLength(500)]
		public string Announcements { get; set; }

		[ForeignKey("MasterId")]
		public virtual CustomerHealthArchiveMaster Master { get; set; }
	}

	/// <summary>
	/// 顾客健康管理记录
	/// </summary>
	public class CustomerHealthManageRecord
	{
		public int Id { get; set; }
		public int MasterId { get; set; }

		[Display(Name = "日期")]
		public DateTime DateTime { get; set; }

		[Display(Name = "部位")]
		[MaxLength(20)]
		public string Region { get; set; }

		[Display(Name = "检测方案")]
		[MaxLength(500)]
		public string TestingProgram { get; set; }

		[Display(Name = "备注")]
		[MaxLength(500)]
		public string Remark { get; set; }

		[Display(Name = "专家")]
		[MaxLength(20)]
		public string Expert { get; set; }

		[ForeignKey("MasterId")]
		public virtual CustomerHealthArchiveMaster Master { get; set; }
	}

	/// <summary>
	/// 顾客回访登记表
	/// </summary>
	public class ReturnVisitRecord
	{
		public int Id { get; set; }
		public int MasterId { get; set; }

		[Display(Name = "回访日期")]
		public DateTime VisitDate { get; set; }

		[Display(Name = "顾客情况")]
		[MaxLength(500)]
		public string CustomerSituation { get; set; }

		[Display(Name = "备注")]
		[MaxLength(500)]
		public string Remark { get; set; }

		[ForeignKey("MasterId")]
		public virtual CustomerHealthArchiveMaster Master { get; set; }
	}
}